import { REMOVE_TAB, SET_ACTIVE_TAB_PATHNAME, SET_KEEP_ALIVE_TABS } from './types.js';

// 设置tabs
const setKeepAliveTabs = (data) => {
  return {
    type: SET_KEEP_ALIVE_TABS,
    payload: data
  };
};

// 设置当前激活的tab
const setActiveTabPathname = (tab) => {
  return {
    type: SET_ACTIVE_TAB_PATHNAME,
    payload: tab
  };
};

// 删除tab
const removeTab = (index) => {
  return {
    type: REMOVE_TAB,
    payload: index
  };
};

export const TabsAction = {
  setActiveTabPathname,
  setKeepAliveTabs,
  removeTab
};
